< previous page page_41 next page >

Page 41
Example program StyleBox, shown in Figure 1.21, demonstrates each of these drawing styles.
Many applications combine DrawMode vbInvert with DrawStyle vbDot to produce dotted rubber-banding effects. Example program RubrBox, shown in Figure 1.22, uses this technique to let you to select a rectangle using the mouse. Click and drag to select a rectangle using a dotted rubber-band box. When you release the mouse, the program fills the box you selected with a random color.
DrawWidth Property
DrawWidth specifies how thick lines, circles, and points are drawn.
Unfortunately, Visual Basic does not honor the DrawStyle property unless DrawWidth is 1. That means you cannot use DrawStyle to draw a thick dotted line.
If you make DrawWidth greater than 1, Visual Basic treats vbDash, vbDot, vbDashDot, and vbDashDotDot as if they were vbSolid. It draws vbSolid and vbInvisible as you would expect, and it draws vbInsideSolid as if DrawWidth were 1. Figure 1.23 shows program StyleBox modified so DrawWidth is 5.
FillStyle Property
FillStyle determines how a box or circle is filled. This property can take the following values.
vbFSSolid
Fills the object with the color specified by FillColor.
vbFSTransparent
Does not fill the object.
vbHorizontalLine
Fills the object with horizontal lines.
vbVerticalLine
Fills the object with vertical lines.
vbUpwardDiagonal
Fills the object with lines slanting upward from right to left.
vbDownwardDiagonal
Fills the object with lines slanting downward from right to left.
vbCross
Fills the object with vertical and horizontal lines.
vbDiagonalCross
Fills the object with lines slanting both upward and downward from right to left.

0041-01.jpg
Figure 1.21
Example program StyleBox demonstrates
Visual Basic's drawing styles.

 
< previous page page_41 next page >